package com.ecfront.test.dao;

import java.util.Date;
import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
import com.ecfront.dao.UserDAO;
import com.ecfront.pojo.Shop;
import com.ecfront.pojo.User;
import com.ecfront.pojo.UserGrade;

public class testUser extends TestCase{
	private static final UserDAO userDao = (UserDAO)SpringUtilTest.getBean("UserDAO");
	//�������
	public void testSave(){
		User user = new User();
		//		user.setId(1);
		
		Shop shop = new Shop();
		shop.setId(1);
		
		user.setShop(shop);
		user.setAdd("����·");
		user.setAge(18);
		user.setAnswer("��ʲô");
		user.setEmail("zhaoke@qaooo.com");
		user.setIc("33010215458451215");
		user.setIsLock(0);
		user.setLastDate(new Date());
		user.setLoginPwd("123456798");
		user.setMobilePhone("15921546521");
		user.setMoney(20.2);
		user.setMsn("sdf@163.com");
		user.setQuestion("������գ�");
		user.setName("��ң");
		user.setPayBank("�й�����");
		user.setPayNum("���к���1321546456");
		user.setPayPwd("sd154545215sd");
		user.setPhone("80512112");
		user.setPhonoUrl("user.jpg");
		
		UserGrade ug = new UserGrade();
		ug.setId(1);
		user.setUg(ug);
		userDao.save(user);
	}
	//���Բ���
	public void testFind(){
		List list = userDao.findAll();
		for(Iterator iter = list.iterator();iter.hasNext();){
			User user = (User)iter.next();
			System.out.println(user.getName());
			System.out.println(user.getUg().getName());
		}

//		User user = userDao.findById(1);
//		System.out.println(user.getName());
//		System.out.println(user.getUg().getName());
		
//		List list = userDao.findByUloginPassword("123456798");
//		for(Iterator iter = list.iterator();iter.hasNext();){
//			User user = (User)iter.next();
//			System.out.println(user.getName());
//			System.out.println(user.getUg().getName());
//		}
		
//		Boolean user = userDao.findUserByNameOrEmailAndPassAndLock("��ңzhaoke@qaooo.com", "123456798",1);
	}
	
}
